<template>
    <Form>
        <cell-group inset>
            <Field
                v-for="rule in rules"
                v-model="rule[1]"
                :name="rule[0]"
                :label="rule[0]"
                :placeholder="rule[2].placeholder || ''"
                :rules="rule[2].rules || []"
            />
        </cell-group>
        <div style="margin: 16px;">
            <Button round block type="primary" @click="$emit('submit')">确认</Button>
        </div>
    </Form>
</template>

<script lang="ts" setup>
import { defineProps } from 'vue'
import { Form, Field, CellGroup, Button } from 'vant';
interface Options {
    rules?: any[],
    placeholder?: string

}
type Rule = [string, string, Options]
interface Props {
    rules: Rule[]
}
defineProps<Props>()
</script>